GtkMenuButton: improve rtl support
authorMatthias Clasen <mclasen@redhat.com>
Sat, 22 Sep 2012 03:53:11 +0000 (23:53 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 22 Sep 2012 03:53:11 +0000 (23:53 -0400)
Show the menu at the side the arrow points to,
also in rtl locales.
https://bugzilla.gnome.org/show_bug.cgi?id=684606

gtk/gtkmenubutton.c

index 0edd78b7ca25ca20406a915eec42f119b7a52c63..051b9da8648140d83d8d94f72a1db407ef8ed1d8 100644 (file)
@@ -336,12 +336,14 @@ menu_position_side_func (GtkMenu       *menu,
   GdkScreen *screen;
   GdkWindow *window;
   GtkAlign align;
+  GtkTextDirection direction;
 
   gtk_widget_get_preferred_size (GTK_WIDGET (priv->popup),
                                  &menu_req, NULL);
 
   window = gtk_widget_get_window (widget);
 
+  direction = gtk_widget_get_direction (widget);
   align = gtk_widget_get_valign (GTK_WIDGET (menu));
   screen = gtk_widget_get_screen (GTK_WIDGET (menu));
   monitor_num = gdk_screen_get_monitor_at_window (screen, window);
@@ -353,7 +355,9 @@ menu_position_side_func (GtkMenu       *menu,
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  if (priv->arrow_type == GTK_ARROW_RIGHT)
+  if ((priv->arrow_type == GTK_ARROW_RIGHT && direction == GTK_TEXT_DIR_LTR) ||
+      (priv->arrow_type == GTK_ARROW_LEFT && direction == GTK_TEXT_DIR_RTL))
+
     {
       if (*x + allocation.width + menu_req.width <= monitor.x + monitor.width)
         *x += allocation.width;